<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head th:replace="common/layout :: common_header(~{::title},~{::link})">
<title>新建客户</title>
</head>
<body>
	<div class="main-container">
		<div class="main-content-inner">
			<div class="page-content">
				<div class="row">
					<form class="form-horizontal" role="form" id="clientAddForm" method="post" th:action="@{/sys/client/save}" >
						<div class="form-group">
                          <label class="col-sm-2 control-label" for="clientname">姓名</label>
                          <div class="col-sm-4">
                             <input class="form-control" id="clientname" name="clientname" type="text" placeholder="请输入姓名" required/>
                          </div>
                          <label class="col-sm-2 control-label" for="clienttelephone">电话号码</label>
                          <div class="col-sm-4">
                             <input class="form-control" id="clienttelephone" name="clienttelephone" type="text" placeholder="请输入电话号码" required/>
                          </div>
                       </div>
                       <div class="form-group">
						   <label class="col-sm-2 control-label" for="clientsex">性别</label>
						   <div class="col-sm-4">
							   <select class="form-control" id="clientsex"  name="clientsex" >
								   <option value="男">男</option>
								   <option value="女">女</option>
							   </select>
						   </div>
						   <label class="col-sm-2 control-label" for="isclientmember">是否会员</label>
						   <div class="col-sm-4">
							   <select class="form-control" id="isclientmember"  name="isclientmember" >
								   <option value="否">否</option>
								   <option value="是">是</option>
							   </select>
						   </div>
                       </div>
						<div class="form-group">
							<!--<label class="col-sm-2 control-label" for="isclientgxc">是否在共享池</label>-->
							<!--<div class="col-sm-4">-->
								<!--<select class="form-control" id="isclientgxc"  name="isclientgxc" >-->
									<!--<option value="否">否</option>-->
									<!--<option value="是">是</option>-->
								<!--</select>-->
							<!--</div>-->
						</div>
						<div class="form-group"></div>
						<div class="form-group"></div>



						<div class="clearfix ">
										<div class="center">
											<button class="btn btn-info" type="submit" id="submitBtn">
												<i class="ace-icon fa fa-check bigger-110"></i>
												保存
											</button>

											&nbsp; &nbsp; &nbsp;
											<button class="btn" type="button" id="closeWin">
												<i class="ace-icon fa fa-del bigger-110"></i>
												关闭
											</button>
										</div>
									</div>
					</form>
				</div>
				<!-- /.col -->
			</div>

		</div>
		<!-- end main container -->
	</div>

	<div th:replace="common/commonJS"></div>
	<script type="text/javascript">
	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
	//关闭iframe
	$('#closeWin').click(function(){
	    top.layer.close(index);
	});
	    
	 $().ready(function() {
		    $("#clientAddForm").validate({
		    	submitHandler: function(form) { 
	        		//验证通过后 的js代码写在这里 
	        		
		    		 $(form).ajaxSubmit({
		                 dataType:"json",
		                 success:function( data ){
		                      if(data==1){
		                    	  top.layer.alert('保存成功') 
		                    	  top.layer.close(index);
		                    	  if(top.getActiveTab()[0]){
		                    		  top.getActiveTab()[0].contentWindow.search();
		                    	  }
		                      }else{
		                    	  top.layer.alert('保存失败')  
		                      }
		                   },
		                   error:function(xhr, status, error){
		                	   top.layer.alert('操作失败');
		                   }
		                 });
	         
	        		}
		    });
		});
	</script>
</body>
</html>